package com.xbongbong.pro.enums.raiders.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.pro.enums.AccessLinkEnum;
import com.xbongbong.pro.enums.HomeMenuEnum;
import com.xbongbong.pro.enums.menu.enums.CRMMenuEnum;
import com.xbongbong.pro.enums.menu.enums.ControlCenterMenuEnum;
import com.xbongbong.pro.enums.menu.enums.FundManagementMenuEnum;
import com.xbongbong.pro.enums.menu.enums.JXCMenuEnum;
import com.xbongbong.pro.enums.menu.enums.OrganizationAuthorityEnum;
import com.xbongbong.pro.enums.menu.enums.ProductMenuEnum;
import com.xbongbong.pro.enums.permission.enums.ProPermissionAliasEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 功能点 之 子级模块（归属到不同的父级模块下）
 *
 * @author zcp
 * @version v1.0
 * @date 19/9/21 021 17:12
 * @update 19/9/21 021 17:12
 * @see RaidersPointParentEnum 子模块对应的各个父模块
 * @since v1.0
 */
@Getter
public enum RaidersPointChildEnum {
    /**
     * （1）需确保pointKey唯一（RaidersPointParentEnum和RaidersPointChildEnum所有的pointKey都互相不同）
     * 原因：
     *      父级也在此枚举内冗余一份，因为要方便维护pointKey的唯一，通过pointKey直接能获取到相应应用或菜单
     *      部分只有一个层级，如工单、图表中心，是不包含子级的，因此选中此种应用时，需要确保与选中菜单的pointKey不同
     * （2）code依赖于不同的类型，主要有：XbbRefTypeEnum、HomeMenuEnum、ControlCenterMenuEnum
     * （3）各模块pointKey规则描述：
     *          父级应用模块 xxx，即1000以下
     *          CRM模块 1xxx
     *          资金管理模块 2xxx
     *          进销存模块 3xxx
     *          表单模板模块 4xxx
     *          流程设置模块 5xxx
     *          组织权限模块 6xxx
     */

    /**
     * 父级应用模块 xxx，即1000以下
     * 【重要】需确保与RaidersPointParentEnum内一致
     */
    CRM(RaidersPointParentEnum.CRM.getPointKey(), XbbRefTypeEnum.CRM.getAlias(), XbbRefTypeEnum.CRM.getI18nName(), RaidersPointParentEnum.CRM,
            //链接，iconColor
            AccessLinkEnum.CRM, AccessLinkEnum.CRM, RaidersPointParentEnum.CRM.getProPermissionAliasEnum()),

    PRODUCT(RaidersPointParentEnum.PRODUCT.getPointKey(), XbbRefTypeEnum.PRODUCT.getAlias(), XbbRefTypeEnum.PRODUCT.getI18nName(), RaidersPointParentEnum.PRODUCT,
            //链接，iconColor
            AccessLinkEnum.PRODUCT, AccessLinkEnum.PRODUCT, RaidersPointParentEnum.PRODUCT.getProPermissionAliasEnum()),

    FUND_MANAGEMENT(RaidersPointParentEnum.FUND_MANAGEMENT.getPointKey(), XbbRefTypeEnum.FUND_MANAGEMENT.getAlias(), XbbRefTypeEnum.FUND_MANAGEMENT.getI18nName(), RaidersPointParentEnum.FUND_MANAGEMENT,
            AccessLinkEnum.FUND_MANAGEMENT, AccessLinkEnum.FUND_MANAGEMENT, RaidersPointParentEnum.FUND_MANAGEMENT.getProPermissionAliasEnum()),

    JXC(RaidersPointParentEnum.JXC.getPointKey(), XbbRefTypeEnum.JXC.getAlias(), XbbRefTypeEnum.JXC.getI18nName(), RaidersPointParentEnum.JXC,
            AccessLinkEnum.JXC, AccessLinkEnum.JXC, RaidersPointParentEnum.JXC.getProPermissionAliasEnum()),

    WORK_ORDER(RaidersPointParentEnum.WORK_ORDER.getPointKey(), XbbRefTypeEnum.WORK_ORDER.getAlias(), XbbRefTypeEnum.WORK_ORDER.getI18nName(), RaidersPointParentEnum.WORK_ORDER,
            AccessLinkEnum.WORK_ORDER, AccessLinkEnum.WORK_ORDER, RaidersPointParentEnum.WORK_ORDER.getProPermissionAliasEnum()),

    HOME(RaidersPointParentEnum.HOME.getPointKey(), HomeMenuEnum.HOME.getAlias(), HomeMenuEnum.HOME.getI18nName(), RaidersPointParentEnum.HOME,
            AccessLinkEnum.HOME, AccessLinkEnum.HOME, RaidersPointParentEnum.HOME.getProPermissionAliasEnum()),

    CHART_CENTER(RaidersPointParentEnum.CHART_CENTER.getPointKey(), HomeMenuEnum.CHART_CENTER.getAlias(), HomeMenuEnum.CHART_CENTER.getI18nName(), RaidersPointParentEnum.CHART_CENTER,
            AccessLinkEnum.CHART_CENTER, AccessLinkEnum.CHART_CENTER, RaidersPointParentEnum.CHART_CENTER.getProPermissionAliasEnum()),

    FORM_TEMPLATE(RaidersPointParentEnum.FORM_TEMPLATE.getPointKey(), ControlCenterMenuEnum.FORM_TEMPLATE.getAlias(), ControlCenterMenuEnum.FORM_TEMPLATE.getI18nName(), RaidersPointParentEnum.FORM_TEMPLATE,
            AccessLinkEnum.FORM_TEMPLATE, AccessLinkEnum.FORM_TEMPLATE, RaidersPointParentEnum.FORM_TEMPLATE.getProPermissionAliasEnum()),

    PROCESS_SETTINGS(RaidersPointParentEnum.PROCESS_SETTINGS.getPointKey(), ControlCenterMenuEnum.PROCESS_SETTINGS.getAlias(), ControlCenterMenuEnum.PROCESS_SETTINGS.getI18nName(), RaidersPointParentEnum.PROCESS_SETTINGS,
            AccessLinkEnum.PROCESS_SETTINGS, AccessLinkEnum.PROCESS_SETTINGS, RaidersPointParentEnum.PROCESS_SETTINGS.getProPermissionAliasEnum()),

    ORGANIZATION_AUTHORITY(RaidersPointParentEnum.ORGANIZATION_AUTHORITY.getPointKey(), ControlCenterMenuEnum.ORGANIZATION_AUTHORITY.getAlias(), ControlCenterMenuEnum.ORGANIZATION_AUTHORITY.getI18nName(), RaidersPointParentEnum.ORGANIZATION_AUTHORITY,
            AccessLinkEnum.ORGANIZATION_AUTHORITY, AccessLinkEnum.ORGANIZATION_AUTHORITY, RaidersPointParentEnum.ORGANIZATION_AUTHORITY.getProPermissionAliasEnum()),
    /**
     * CRM模块 1xxx
     *
     * @see com.xbongbong.pro.enums.menu.enums.CRMMenuEnum 获取AccessLinkEnum跳转链接参考枚举
     */
    CUSTOMER_MANAGEMENT(1000, XbbRefTypeEnum.CUSTOMER.getAlias(), XbbRefTypeEnum.CUSTOMER.getI18nName(), RaidersPointParentEnum.CRM,
            //AccessLinkEnum.CUSTOMER_MANAGEMENT内链接是空的，所以使用 CUSTOMER 对应的链接；但是icon和color是需要用客户管理的
            CRMMenuEnum.CUSTOMER.getAccessLinkEnum(), CRMMenuEnum.CUSTOMER.getAccessLinkEnum(), ProPermissionAliasEnum.CUSTOMER_VIEW),

    CONTACT(1010, XbbRefTypeEnum.CONTACT.getAlias(), XbbRefTypeEnum.CONTACT.getI18nName(), RaidersPointParentEnum.CRM,
            CRMMenuEnum.CONTACT.getAccessLinkEnum(), CRMMenuEnum.CONTACT.getAccessLinkEnum(), ProPermissionAliasEnum.CONTACT_VIEW),

    CUSTOMER_COMMUNICATE(1020, XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getAlias(), XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getI18nName(), RaidersPointParentEnum.CRM,
            CRMMenuEnum.CUSTOMER_COMMUNICATE.getAccessLinkEnum(), CRMMenuEnum.CUSTOMER_COMMUNICATE.getAccessLinkEnum(), ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_VIEW),

    COMMUNICATE_PLAN(1030, XbbRefTypeEnum.COMMUNICATE_PLAN.getAlias(), XbbRefTypeEnum.COMMUNICATE_PLAN.getI18nName(), RaidersPointParentEnum.CRM,
            CRMMenuEnum.COMMUNICATE_PLAN.getAccessLinkEnum(), CRMMenuEnum.COMMUNICATE_PLAN.getAccessLinkEnum(), ProPermissionAliasEnum.COMMUNICATE_PLAN_VIEW),

    SALES_OPPORTUNITY(1040, XbbRefTypeEnum.ALL_OPPORTUNITY.getAlias(), XbbRefTypeEnum.ALL_OPPORTUNITY.getI18nName(), RaidersPointParentEnum.CRM,
            //AccessLinkEnum.SALES_OPPORTUNITY内链接是空的，所以用 ALL_OPPORTUNITY 对应的链接；但是icon和color是需要用销售机会的
            CRMMenuEnum.ALL_OPPORTUNITY.getAccessLinkEnum(), CRMMenuEnum.ALL_OPPORTUNITY.getAccessLinkEnum(), ProPermissionAliasEnum.OPPORTUNITY_VIEW),

    CONTRACT(1050, XbbRefTypeEnum.CONTRACT.getAlias(), XbbRefTypeEnum.CONTRACT.getI18nName(), RaidersPointParentEnum.CRM,
            CRMMenuEnum.CONTRACT.getAccessLinkEnum(), CRMMenuEnum.CONTRACT.getAccessLinkEnum(), ProPermissionAliasEnum.CONTRACT_VIEW),

    REFUND(1060, XbbRefTypeEnum.REFUND.getAlias(), XbbRefTypeEnum.REFUND.getI18nName(), RaidersPointParentEnum.CRM,
            CRMMenuEnum.REFUND.getAccessLinkEnum(), CRMMenuEnum.REFUND.getAccessLinkEnum(), ProPermissionAliasEnum.REFUND_VIEW),

    SIGNIN(1070, XbbRefTypeEnum.SIGNIN.getAlias(), XbbRefTypeEnum.SIGNIN.getI18nName(), RaidersPointParentEnum.CRM,
            CRMMenuEnum.SIGN_IN.getAccessLinkEnum(), CRMMenuEnum.SIGN_IN.getAccessLinkEnum(), ProPermissionAliasEnum.SIGN_IN_VIEW),

    WORK_REPORT(1080, XbbRefTypeEnum.WORK_REPORT.getAlias(), XbbRefTypeEnum.WORK_REPORT.getI18nName(), RaidersPointParentEnum.CRM,
            CRMMenuEnum.WORK_REPORT.getAccessLinkEnum(), CRMMenuEnum.WORK_REPORT.getAccessLinkEnum(), ProPermissionAliasEnum.WORK_REPORT_VIEW),

    /**
     * 产品模块 15xx
     *
     * @see com.xbongbong.pro.enums.menu.enums.ProductMenuEnum 获取AccessLinkEnum跳转链接参考枚举
     */
    PRODUCT_MANAGEMENT(1500, XbbRefTypeEnum.PRODUCT.getAlias(), XbbRefTypeEnum.PRODUCT.getI18nName(), RaidersPointParentEnum.PRODUCT,
            ProductMenuEnum.PRODUCT.getAccessLinkEnum(), ProductMenuEnum.PRODUCT.getAccessLinkEnum(), ProPermissionAliasEnum.PRODUCT_VIEW),

    /**
     * 资金管理模块 2xxx
     *
     * @see com.xbongbong.pro.enums.menu.enums.FundManagementMenuEnum 获取AccessLinkEnum跳转链接参考枚举
     */
    PAYMENT(2000, XbbRefTypeEnum.PAYMENT.getAlias(), XbbRefTypeEnum.PAYMENT.getI18nName(), RaidersPointParentEnum.FUND_MANAGEMENT,
            FundManagementMenuEnum.PAYMENT.getAccessLinkEnum(), FundManagementMenuEnum.PAYMENT.getAccessLinkEnum(), ProPermissionAliasEnum.PAYMENT_VIEW),

    INVOICE(2010, XbbRefTypeEnum.INVOICE.getAlias(), XbbRefTypeEnum.INVOICE.getI18nName(), RaidersPointParentEnum.FUND_MANAGEMENT,
            FundManagementMenuEnum.INVOICE.getAccessLinkEnum(), FundManagementMenuEnum.INVOICE.getAccessLinkEnum(), ProPermissionAliasEnum.INVOICE_VIEW),

    PAY_PLAN(2020, XbbRefTypeEnum.PAY_PLAN.getAlias(), XbbRefTypeEnum.PAY_PLAN.getI18nName(), RaidersPointParentEnum.FUND_MANAGEMENT,
            FundManagementMenuEnum.PAY_PLAN.getAccessLinkEnum(), FundManagementMenuEnum.PAY_PLAN.getAccessLinkEnum(), ProPermissionAliasEnum.PAY_PLAN_VIEW),

    /**
     * 进销存模块 3xxx
     *
     * @see com.xbongbong.pro.enums.menu.enums.JXCMenuEnum 获取AccessLinkEnum跳转链接参考枚举
     */
    SUPPLIER(3000, XbbRefTypeEnum.SUPPLIER.getAlias(), XbbRefTypeEnum.SUPPLIER.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.SUPPLIER.getAccessLinkEnum(), JXCMenuEnum.SUPPLIER.getAccessLinkEnum(), ProPermissionAliasEnum.SUPPLIER_VIEW),

    SUPPLIER_CONTACT(3010, XbbRefTypeEnum.SUPPLIER_CONTACT.getAlias(), XbbRefTypeEnum.SUPPLIER_CONTACT.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.SUPPLIER_CONTACT.getAccessLinkEnum(), JXCMenuEnum.SUPPLIER_CONTACT.getAccessLinkEnum(), ProPermissionAliasEnum.SUPPLIER_CONTACT_VIEW),

    SUPPLIER_COMMUNICATE(3020, XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getAlias(), XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.SUPPLIER_CUSTOMER_COMMUNICATE.getAccessLinkEnum(), JXCMenuEnum.SUPPLIER_CUSTOMER_COMMUNICATE.getAccessLinkEnum(), ProPermissionAliasEnum.SUPPLIER_COMMUNICATE_VIEW),

    PURCHASE(3030, XbbRefTypeEnum.PURCHASE.getAlias(), XbbRefTypeEnum.PURCHASE.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.PURCHASE.getAccessLinkEnum(), JXCMenuEnum.PURCHASE.getAccessLinkEnum(), ProPermissionAliasEnum.PURCHASE),

    RETURNED_PURCHASE(3040, XbbRefTypeEnum.RETURNED_PURCHASE.getAlias(), XbbRefTypeEnum.RETURNED_PURCHASE.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.RETURNED_PURCHASE.getAccessLinkEnum(), JXCMenuEnum.RETURNED_PURCHASE.getAccessLinkEnum(), ProPermissionAliasEnum.RETURN_PURCHASE_VIEW),

    BOM_BILL(3050, XbbRefTypeEnum.BOM_BILL.getAlias(), XbbRefTypeEnum.BOM_BILL.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.BOM_BILL.getAccessLinkEnum(), JXCMenuEnum.BOM_BILL.getAccessLinkEnum(), ProPermissionAliasEnum.BOM_BILL_VIEW),

    SIMULATED_PRODUCTION(3060, XbbRefTypeEnum.SIMULATED_PRODUCTION.getAlias(), XbbRefTypeEnum.SIMULATED_PRODUCTION.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.SIMULATED_PRODUCTION.getAccessLinkEnum(), JXCMenuEnum.SIMULATED_PRODUCTION.getAccessLinkEnum(), ProPermissionAliasEnum.SIMULATED_PRODUCTION),

    PRODUCTION_ORDER(3070, XbbRefTypeEnum.PRODUCTION_ORDER.getAlias(), XbbRefTypeEnum.PRODUCTION_ORDER.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.PRODUCTION_ORDER.getAccessLinkEnum(), JXCMenuEnum.PRODUCTION_ORDER.getAccessLinkEnum(), ProPermissionAliasEnum.PRODUCTION_ORDER_VIEW),

    ASSEMBLE(3080, XbbRefTypeEnum.ASSEMBLE.getAlias(), XbbRefTypeEnum.ASSEMBLE.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.ASSEMBLE.getAccessLinkEnum(), JXCMenuEnum.ASSEMBLE.getAccessLinkEnum(), ProPermissionAliasEnum.ASSEMBLE_VIEW),

    INSTOCK(3090, XbbRefTypeEnum.INSTOCK.getAlias(), XbbRefTypeEnum.INSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.INSTOCK_MANAGEMENT.getAccessLinkEnum(), JXCMenuEnum.INSTOCK_MANAGEMENT.getAccessLinkEnum(), ProPermissionAliasEnum.INSTOCK_VIEW),

    OUTSTOCK(3100, XbbRefTypeEnum.OUTSTOCK.getAlias(), XbbRefTypeEnum.OUTSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.OUTSTOCK_MANAGEMENT.getAccessLinkEnum(), JXCMenuEnum.OUTSTOCK_MANAGEMENT.getAccessLinkEnum(), ProPermissionAliasEnum.OUTSTOCK_VIEW),

    INVENTORY(3110, XbbRefTypeEnum.INVENTORY.getAlias(), XbbRefTypeEnum.INVENTORY.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.INVENTORY.getAccessLinkEnum(), JXCMenuEnum.INVENTORY.getAccessLinkEnum(), ProPermissionAliasEnum.INVENTORY_VIEW),

    TRANSFER(3120, XbbRefTypeEnum.TRANSFER.getAlias(), XbbRefTypeEnum.TRANSFER.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.TRANSFER.getAccessLinkEnum(), JXCMenuEnum.TRANSFER.getAccessLinkEnum(), ProPermissionAliasEnum.TRANSFER_VIEW),

    WAREHOUSE(3130, XbbRefTypeEnum.WAREHOUSE.getAlias(), XbbRefTypeEnum.WAREHOUSE.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.WAREHOUSE.getAccessLinkEnum(), JXCMenuEnum.WAREHOUSE.getAccessLinkEnum(), ProPermissionAliasEnum.WAREHOUSE_VIEW),

    STOCK_SEARCH(3140, XbbRefTypeEnum.STOCK_SEARCH.getAlias(), XbbRefTypeEnum.STOCK_SEARCH.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.STOCK_SEARCH.getAccessLinkEnum(), JXCMenuEnum.STOCK_SEARCH.getAccessLinkEnum(), ProPermissionAliasEnum.STOCK_SEARCH_VIEW),

    PURCHASE_MANAGEMENT(3150, XbbRefTypeEnum.PURCHASE_MANAGEMENT.getAlias(), XbbRefTypeEnum.PURCHASE_MANAGEMENT.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.PURCHASE_MANAGEMENT.getAccessLinkEnum(), JXCMenuEnum.PURCHASE_MANAGEMENT.getAccessLinkEnum(), ProPermissionAliasEnum.PURCHASE_VIEW),

    PRODUCTION_MANAGEMENT(3160, XbbRefTypeEnum.PRODUCTION_MANAGEMENT.getAlias(), XbbRefTypeEnum.PRODUCTION_MANAGEMENT.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.PRODUCTION_MANAGEMENT.getAccessLinkEnum(), JXCMenuEnum.PRODUCTION_MANAGEMENT.getAccessLinkEnum(), ProPermissionAliasEnum.PRODUCTION_ORDER),

    INVENTORY_MANAGEMENT(3170, XbbRefTypeEnum.INVENTORY_MANAGEMENT.getAlias(), XbbRefTypeEnum.INVENTORY_MANAGEMENT.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.INVENTORY_MANAGEMENT.getAccessLinkEnum(), JXCMenuEnum.INVENTORY_MANAGEMENT.getAccessLinkEnum(), ProPermissionAliasEnum.INVENTORY_VIEW),

    STOCK_FLOW_BILL(3180, XbbRefTypeEnum.STOCK_FLOW_BILL.getAlias(), XbbRefTypeEnum.STOCK_FLOW_BILL.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.STOCK_FLOW_BILL.getAccessLinkEnum(), JXCMenuEnum.STOCK_FLOW_BILL.getAccessLinkEnum(), ProPermissionAliasEnum.STOCK_FLOW_BILL_VIEW),

    STOCK_STANDING_BOOK(3190, XbbRefTypeEnum.STOCK_STANDING_BOOK.getAlias(), XbbRefTypeEnum.STOCK_STANDING_BOOK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.STOCK_STANDING_BOOK.getAccessLinkEnum(), JXCMenuEnum.STOCK_STANDING_BOOK.getAccessLinkEnum(), ProPermissionAliasEnum.STOCK_STANDING_BOOK_VIEW),

    PURCHASE_INSTOCK(3200, XbbRefTypeEnum.PURCHASE_INSTOCK.getAlias(), XbbRefTypeEnum.PURCHASE_INSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.PURCHASE_INSTOCK.getAccessLinkEnum(), JXCMenuEnum.PURCHASE_INSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.PURCHASE_INSTOCK_VIEW),

    REFUND_INSTOCK(3210, XbbRefTypeEnum.REFUND_INSTOCK.getAlias(), XbbRefTypeEnum.REFUND_INSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.REFUND_INSTOCK.getAccessLinkEnum(), JXCMenuEnum.REFUND_INSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.REFUND_INSTOCK_VIEW),

    OTHER_INSTOCK(3220, XbbRefTypeEnum.OTHER_INSTOCK.getAlias(), XbbRefTypeEnum.OTHER_INSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.OTHER_INSTOCK.getAccessLinkEnum(), JXCMenuEnum.OTHER_INSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.INSTOCK_VIEW),

    PRODUCTION_INSTOCK(3230, XbbRefTypeEnum.PRODUCTION_INSTOCK.getAlias(), XbbRefTypeEnum.PRODUCTION_INSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.PRODUCTION_INSTOCK.getAccessLinkEnum(), JXCMenuEnum.PRODUCTION_INSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.PRODUCTION_INSTOCK_VIEW),

    RETURNED_MATERIEL_INSTOCK(3240, XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getAlias(), XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.RETURNED_MATERIEL_INSTOCK.getAccessLinkEnum(), JXCMenuEnum.RETURNED_MATERIEL_INSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.RETURNED_MATERIEL_INSTOCK_VIEW),

    CONTRACT_OUTSTOCK(3250, XbbRefTypeEnum.CONTRACT_OUTSTOCK.getAlias(), XbbRefTypeEnum.CONTRACT_OUTSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.CONTRACT_OUTSTOCK.getAccessLinkEnum(), JXCMenuEnum.CONTRACT_OUTSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.CONTRACT_OUTSTOCK_VIEW),

    RETURNED_PURCHASE_OUTSTOCK(3260, XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getAlias(), XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.RETURNED_PURCHASE_OUTSTOCK.getAccessLinkEnum(), JXCMenuEnum.RETURNED_PURCHASE_OUTSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.RETURNED_PURCHASE_OUTSTOCK_VIEW),

    OTHER_OUTSTOCK(3270, XbbRefTypeEnum.OTHER_OUTSTOCK.getAlias(), XbbRefTypeEnum.OTHER_OUTSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.OTHER_OUTSTOCK.getAccessLinkEnum(), JXCMenuEnum.OTHER_OUTSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.OUTSTOCK_VIEW),

    PRODUCTION_MATERIEL_OUTSTOCK(3280, XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getAlias(), XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.PRODUCTION_MATERIEL_OUTSTOCK.getAccessLinkEnum(), JXCMenuEnum.PRODUCTION_MATERIEL_OUTSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.PRODUCTION_MATERIEL_OUTSTOCK_VIEW),

    WORK_ORDER_OUTSTOCK(3290, XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getAlias(), XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getI18nName(), RaidersPointParentEnum.JXC,
            JXCMenuEnum.WORK_ORDER_OUTSTOCK.getAccessLinkEnum(), JXCMenuEnum.WORK_ORDER_OUTSTOCK.getAccessLinkEnum(), ProPermissionAliasEnum.WORK_ORDER_OUTSTOCK_VIEW),




    /**
     * 表单模板模块 4xxx
     * 链接用 FORM_TEMPLATE 的，但是icon和color的还是用相应应用的，如crm的icon和color直接使用crm的即可
     */
    FORM_TEMPLATE_CRM(4000, XbbRefTypeEnum.CRM.getAlias(), XbbRefTypeEnum.CRM.getI18nName(), RaidersPointParentEnum.FORM_TEMPLATE,
            AccessLinkEnum.FORM_TEMPLATE, CRM.iconColor, ProPermissionAliasEnum.FORM_SET_VIEW),

    FORM_TEMPLATE_FUND_MANAGEMENT(4010, XbbRefTypeEnum.FUND_MANAGEMENT.getAlias(), XbbRefTypeEnum.FUND_MANAGEMENT.getI18nName(), RaidersPointParentEnum.FORM_TEMPLATE,
            AccessLinkEnum.FORM_TEMPLATE, FUND_MANAGEMENT.iconColor, ProPermissionAliasEnum.FORM_SET_VIEW),

    FORM_TEMPLATE_JXC(4020, XbbRefTypeEnum.JXC.getAlias(), XbbRefTypeEnum.JXC.getI18nName(), RaidersPointParentEnum.FORM_TEMPLATE,
            AccessLinkEnum.FORM_TEMPLATE, JXC.iconColor, ProPermissionAliasEnum.FORM_SET_VIEW),

    FORM_TEMPLATE_PRODUCT(4030, XbbRefTypeEnum.PRODUCT.getAlias(), XbbRefTypeEnum.PRODUCT.getI18nName(), RaidersPointParentEnum.FORM_TEMPLATE,
            AccessLinkEnum.FORM_TEMPLATE, AccessLinkEnum.PRODUCT, ProPermissionAliasEnum.FORM_SET_VIEW),

    /**
     * 流程设置模块 5xxx
     * 链接用 PROCESS_SETTINGS 的，但是icon和color的还是用相应应用的，如crm的icon和color直接使用crm的即可
     */
    PROCESS_SETTINGS_CRM(5000, XbbRefTypeEnum.CRM.getAlias(), XbbRefTypeEnum.CRM.getI18nName(), RaidersPointParentEnum.PROCESS_SETTINGS,
            AccessLinkEnum.PROCESS_SETTINGS, CRM.iconColor, ProPermissionAliasEnum.PROCESS_SET_VIEW),

    PROCESS_SETTINGS_FUND_MANAGEMENT(5010, XbbRefTypeEnum.FUND_MANAGEMENT.getAlias(), XbbRefTypeEnum.FUND_MANAGEMENT.getI18nName(), RaidersPointParentEnum.PROCESS_SETTINGS,
            AccessLinkEnum.PROCESS_SETTINGS, FUND_MANAGEMENT.iconColor, ProPermissionAliasEnum.PROCESS_SET_VIEW),

    PROCESS_SETTINGS_JXC(5020, XbbRefTypeEnum.JXC.getAlias(), XbbRefTypeEnum.JXC.getI18nName(), RaidersPointParentEnum.PROCESS_SETTINGS,
            AccessLinkEnum.PROCESS_SETTINGS, JXC.iconColor, ProPermissionAliasEnum.PROCESS_SET_VIEW),

    /**
     * 组织权限模块 6xxx
     *
     * @see OrganizationAuthorityEnum 获取AccessLinkEnum跳转链接参考枚举
     */
    ORGANIZATION(6000, OrganizationAuthorityEnum.ORGANIZATION.getAlias(), OrganizationAuthorityEnum.ORGANIZATION.getI18nName(), RaidersPointParentEnum.ORGANIZATION_AUTHORITY,
            OrganizationAuthorityEnum.ORGANIZATION.getAccessLinkEnum(), OrganizationAuthorityEnum.ORGANIZATION.getAccessLinkEnum(), ProPermissionAliasEnum.ORGANIZATION),

    ROLE_PERMISSION(6010, OrganizationAuthorityEnum.ROLE_PERMISSION.getAlias(), OrganizationAuthorityEnum.ROLE_PERMISSION.getI18nName(), RaidersPointParentEnum.ORGANIZATION_AUTHORITY,
            OrganizationAuthorityEnum.ROLE_PERMISSION.getAccessLinkEnum(), OrganizationAuthorityEnum.ROLE_PERMISSION.getAccessLinkEnum(), ProPermissionAliasEnum.ROLE_PERMISSION),

    UNKNOWN(404, "", "", null, null, null, null);

    ;

    /**
     * 枚举值 -- 攻略内所属pointKey
     */
    private final Integer pointKey;

    /**
     * 枚举值 -- 对应pro内的menu或app类型alias
     */
    private final String alias;
    /**
     * 枚举信息--中文名称
     */
    private final String name;

    /**
     * 父级枚举
     */
    private final RaidersPointParentEnum parentEnum;

    /**
     * 访问链接枚举类
     */
    private AccessLinkEnum accessLinkEnum;

    /**
     * icon、color枚举
     */
    private AccessLinkEnum iconColor;

    /**
     * 权限别名枚举
     */
    private final ProPermissionAliasEnum proPermissionAliasEnum;

    RaidersPointChildEnum(Integer pointKey, String alias, String name, RaidersPointParentEnum parentEnum, AccessLinkEnum accessLinkEnum, AccessLinkEnum iconColor, ProPermissionAliasEnum proPermissionAliasEnum) {
        this.pointKey = pointKey;
        this.alias = alias;
        this.name = name;
        this.parentEnum = parentEnum;
        this.accessLinkEnum = accessLinkEnum;
        this.iconColor = iconColor;
        this.proPermissionAliasEnum = proPermissionAliasEnum;
    }

    /**
     * 通过pointKey获取功能点枚举
     * @param pointKey
     * @return com.xbongbong.pro.enums.raiders.enums.RaidersPointChildEnum
     * @author zcp
     * @date 19/10/17 017 16:44
     * @update 19/10/17 017 16:44
     * @since v1.0
     * @version v1.0
     */
    public static RaidersPointChildEnum getByPointKey(Integer pointKey) {
        for (RaidersPointChildEnum cache : values()) {
            if (Objects.equals(cache.pointKey, pointKey)) {
                return cache;
            }
        }
        return UNKNOWN;
    }

    /**
     * 获取父级所有的子级
     * @param parentEnum 父级
     * @return java.util.List<com.xbongbong.pro.enums.raiders.enums.RaidersPointChildEnum>
     * @author zcp
     * @date 19/9/21 021 18:59
     * @update 19/9/21 021 18:59
     * @since v1.0
     * @version v1.0
     */
    public static List<RaidersPointChildEnum> getChildListByParent(RaidersPointParentEnum parentEnum) {
        List<RaidersPointChildEnum> list = new ArrayList<>();
        for (RaidersPointChildEnum cache : values()) {
            /**
             * 与传入的父级枚举相等，且该枚举的pointKey与传入的父枚举的pointKey不相等，则为该parentEnum的子级
             * 原因：
             *      父级也在此枚举内冗余一份，因为要方便维护pointKey的唯一，通过pointKey直接能获取到相应应用或菜单
             *      部分只有一个层级，如工单、图表中心，是不包含子级的，因此选中此种应用时，需要确保与选中菜单的pointKey不同
             */
            boolean flagChild = Objects.equals(cache.parentEnum, parentEnum) && !Objects.equals(cache.getPointKey(), parentEnum.getPointKey());
            if (flagChild) {
                list.add(cache);
            }
        }
        return list;
    }

    /**
     * jxc获取所有父级
     * @return
     */
    public static List<RaidersPointChildEnum> getJXCParentList() {
        List<RaidersPointChildEnum> list = new ArrayList<>();
        for (RaidersPointChildEnum cache : values()) {
            //判断是否是进销存
            boolean jxcFlag =  Objects.equals(cache.parentEnum, RaidersPointParentEnum.JXC) && Objects.equals(cache.parentEnum.getPointKey(),RaidersPointParentEnum.JXC.getPointKey()) ;
            if (jxcFlag){
                for (JXCMenuEnum menuEnum : JXCMenuEnum.values()) {
                    boolean flagParent = menuEnum.getParent().isEmpty() && Objects.equals(cache.getAlias(), menuEnum.getAlias());
                    if (flagParent) {
                        list.add(cache);
                        break;
                    }
                }
            }
        }
        return list;
    }

    /**
     * jxc获取子级
     * @return
     */
    public static List<RaidersPointChildEnum> getJXCChildList(RaidersPointChildEnum parentEnum) {
        List<RaidersPointChildEnum> list = new ArrayList<>();
        for (RaidersPointChildEnum cache : values()) {
            //判断是否是进销存
            boolean jxcFlag = Objects.equals(cache.parentEnum, RaidersPointParentEnum.JXC) && Objects.equals(cache.parentEnum.getPointKey(),RaidersPointParentEnum.JXC.getPointKey()) && !Objects.equals(cache.getPointKey(), RaidersPointParentEnum.JXC.getPointKey());
            if (jxcFlag) {
                //判断是否是子级
                for (JXCMenuEnum menuEnum : JXCMenuEnum.values()) {
                    boolean flagChild = Objects.equals(cache.getAlias(),menuEnum.getAlias()) && Objects.equals(parentEnum.getAlias(),menuEnum.getParent());
                    if (flagChild) {
                        list.add(cache);
                        break;
                    }
                }
            }
        }
        return list;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
